#!/usr/bin/perl
##############################
my $file = "DT to Unicode.csv";

my $RS = $/;
undef $/;

unless( open( FILE, $file ) )
{
	die "Unable to open [$file]: $!\n";
}

my $file = <FILE>;

close( FILE );

$/ = $RS;

$output = "InDesign";

if( $output eq "perl" )
{
	print << 'ENDperl';
    my %DTToUnicode = ( 
ENDperl
}

if( $output eq "InDesign" )
{
	print << 'ENDindd';
    my %UnicodeToInDesign = (
ENDindd
}

foreach my $line ( split( /\015/, $file ) )
{
	next if( $line =~ /^DT Mnemonic/ );

	my( $dt, $unicode, $forInDesign ) = split( /\,/, $line );

	if( ($output eq "InDesign") && $forInDesign )
	{
		print << "ENDindd";
                 '$dt' => '$unicode',
ENDindd
	}
	
	if( $output eq "perl" )
	{
		print << "ENDperl";
                 '$dt' => '$unicode',
ENDperl
	}
}

if( $output eq "perl" )
{
	print << 'ENDperl';
                 'BLANK' => ''
	);
ENDperl
}

if( $output eq "InDesign" )
{
	print << 'ENDindd';
	);
ENDindd
}

